package com.ymatou.iapi.csim.testcase;

import java.text.SimpleDateFormat;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.csim.parameter.GetMessageListByPageBean;
import com.ymatou.iapi.csim.parameter.SendMessageCSBean;
import com.ymatou.iapi.csim.service.GetMessageListByPageCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CsimCallService;
import com.ymttest.database.model.ymt_cssession;
import com.ymttest.database.sqlwapper.CSIM.ymt_cssessionWapper;
import com.ymttest.database.sqlwapper.CSIM.ymt_onlinecsWapper;
import com.ymttest.utils.EnvSetup;
/**
*分页查询消息列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetMessageListByPage{
	private static GetMessageListByPageBean getmessagelistbypageBean;
	private static GetMessageListByPageCall getmessagelistbypageCall;
	private CsimCallService service=new CsimCallService();
	private Integer csId=Integer.parseInt(EnvSetup.getData("csId").toString());
	private static Integer userId=Integer.parseInt(EnvSetup.getData("userId_IM").toString());
	SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("分页查询消息列表-研发没有做，没有流量");
	}

	@Before
	public void caseUp() {
		getmessagelistbypageBean=new GetMessageListByPageBean();
		getmessagelistbypageCall=new GetMessageListByPageCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getmessagelistbypageCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetMessageListByPage_001() {
		Logger.start(true,"分页查询消息列表");
		try {
			//客服上线
			service.getOnlineCS(csId);
			//打开会话
			ymt_cssession cssession=service.getOpenSession(csId,userId);
			//发消息
			SendMessageCSBean sendMessageCSBean=service.setSendMessageCSBean();
			sendMessageCSBean.setSessionId(cssession.getId());
			sendMessageCSBean.setCsId(csId);
			sendMessageCSBean.setUserId(userId);
			service.setSendMessageCSCall(sendMessageCSBean);
			
			getmessagelistbypageBean.setUserId(userId);
			//getmessagelistbypageBean.setContactUserId(contactUserId);
			getmessagelistbypageBean.setCurrentPage(1);
			getmessagelistbypageBean.setPageSize(10);
			getmessagelistbypageCall.setData(getmessagelistbypageBean);
			getmessagelistbypageCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}